/**
* @program: src
*
* @description:
*
* @author: Mr.chen
*
* @create: 2022-03-09 17:43
**/
package response
const (
	// OK ok
	OK = 200
	// RequestErr request error
	RequestErr = 400
	// ServerErr server error
	ServerErr = 500
	contextErrCode = "context/err/code"
)
type ResponseSuccess struct {
	Code int      `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data,omitempty"`
}
type NullJson struct{}

func Success(data interface{}) *ResponseSuccess {
	return &ResponseSuccess{200, "OK", data}
}

type ResponseError struct {
	Code int `json:"code"`
	Msg  string `json:"msg"`
}

func Error(errCode int, errMsg string) *ResponseError {
	return &ResponseError{errCode, errMsg}
}
